﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master_form.master" AutoEventWireup="true" CodeFile="ns_phong.aspx.cs" Inherits="App_Form_Nhan_su_ns_phong" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        function P_DATA(b_gtri) {

            var a_data2 = Ext.create('Ext.data.Store', {
                fields: ['id_ns', 'ten', 'ngay_sinh', 'gioi_tinh'],
                data: b_gtri
            });

            Ext.require([
            'Ext.selection.CellModel',
            'Ext.grid.*',
            'Ext.data.*',
            'Ext.util.*',
            'Ext.state.*',
            'Ext.form.*',
            'Ext.grid.Panel'
            ]);

            Ext.onReady(function () {

                Ext.QuickTips.init();

                var bd = Ext.getBody();

                var gridForm = Ext.create('Ext.form.Panel',
                {
                    id: 'form_phong',
                    frame: true,
                    layout:
                    {
                        type: 'table',
                        columns: 1
                    },
                    fieldDefaults:
                    {
                        labelAlign: 'left',
                        msgTarget: 'side'
                    },

                    items:
                    [
                        {
                            xtype: 'gridpanel',
                            margin: '0 0 0 1',
                            store: a_data2,
                            id: 'phongban',
                            width: 400,
                            height: 390,
                            title: '',
                            columns: [
                                { id: 'id', flex: 1, text: 'Mã', width: 90, sortable: true, hidden: true, dataIndex: 'id_ns' },
                                { id: 'TEN1', text: 'Tên', width: 120, flex: 1, sortable: true, dataIndex: 'ten' },
                                { id: 'TEN2', text: 'Ngày sinh', width: 90, flex: 1, sortable: true, dataIndex: 'ngay_sinh' },
                                { id: 'TEN3', text: 'Giới tính', width: 90, flex: 1, sortable: true, dataIndex: 'gioi_tinh' }
                            ],
                            listeners: {
                                selectionchange: function (model, records) {
                                    if (records[0]) {
                                        var b_ma = records[0].get("id_ns") + "#" + records[0].get("ten");
                                        $("#ndung").text(b_ma);
                                    }
                                }
                            }
                        }
                    ],
                    renderTo: bd
                });
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="ndung" style="display: none;"></div>
    <script type="text/javascript">
        function P_LOAD_TTCHUNG(b_kq) {
            if (Fb_LOI_KTRA(b_kq)) {
                form_P_LOI(b_kq);
                return;
            }
            else {
                var b_chuoi2 = CH_JSON(b_kq);
                var a_data2 = Ext.create('Ext.data.Store', {
                    fields: ['id_phong', 'Ten'],
                    data: b_chuoi2
                });
                var c = Ext.getCmp('phongban');
                c.bindStore(a_data2);
            }
        }
    </script>
</asp:Content>

